import request from '@/utils/request.js';
import { useTokenStore } from '../stores/token'

// //文章分类列表查询
// export const ArticleCategoryListService = () => {
//     //获取token状态
//     const tokenStore = useTokenStore()
//     //通过请求头Authorization携带token
//     return request.get('/category', { headers: { 'Authorization': tokenStore.token } })
// }

//文章分类列表查询
export const ArticleCategoryListService = () => {
    //获取token状态
    const tokenStore = useTokenStore()
    //通过请求头Authorization携带token
    return request.get('/category')
}

export const ArticleCategoryAddService = (categoryData) => {
    return request.post('/category', categoryData)
}

export const ArticleCategoryUpdateService = (categoryData) => {
    return request.post('/category', categoryData)
}


//删除分类
export const ArticleCategoryDeleteService = (id) => {
    return request.delete('/category?id='+id)
}

export const ArticleListService = (params) => {
    return request.get('/article',{params:params})
}

export const ArticleAddService = (articleData) => {
    return request.post('/article', articleData)
}

